package cntr.symboltable;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Thanh-Trung Pham on 7/22/2016.
 */
public class SystemSymbol extends Symbol implements Scope {
    private Map<String, Symbol> m_oSymbols;

    public SystemSymbol(String name) {
        super(name);
        m_oSymbols = new HashMap<>();
    }

    @Override
    public String getScopeName() {
        return "System";
    }

    @Override
    public Scope getEnclosingScope() {
        return getScope();
    }

    @Override
    public void define(Symbol symbol) {
        m_oSymbols.put(symbol.getName(), symbol);
        symbol.setScope(this);
    }

    @Override
    public Symbol resolve(String name) {
        return m_oSymbols.get(name);

    }

}
